﻿using DX_Recognize.Entitys;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using static DX_Recognize.Utils.ConvertUtils;

namespace DX_Recognize.Common
{
    //执行过程中 需要共享额数据

    //粗分类 孔标签
    public static class CoaGraHoleTagData
    {
        //小螺丝
        public static List<HoleGroupTag> CoaSmallScrewCList = new List<HoleGroupTag>();
        //大螺丝 
        public static List<HoleGroupTag> CoaBigScrewCList = new List<HoleGroupTag>();
        //针板螺丝
        public static List<HoleGroupTag> CoaFallerScrewCList = new List<HoleGroupTag>();
        //回针
        public static List<HoleGroupTag> CoaReturnPinCList = new List<HoleGroupTag>();
        //导柱
        public static List<HoleGroupTag> CoaGPScrewCList = new List<HoleGroupTag>();
        //拉杆
        public static List<HoleGroupTag> CoaSPScrewCList = new List<HoleGroupTag>();
    }

    //装配孔 (候选集)
    public static class HoleCandidateShareData
    {
        //小螺丝(底板螺丝) 候选集
        public static List<ScrewHole> SmallScrewCList = new List<ScrewHole>();
        //大螺丝 
        public static List<ScrewHole> BigScrewCList = new List<ScrewHole>();
        //针板
        public static List<ScrewHole> FallerScrewCList = new List<ScrewHole>();
        //回针
        public static List<ScrewHole> ReturnPinCList = new List<ScrewHole>();
        //导柱
        public static List<ScrewHole> GPScrewCList = new List<ScrewHole>();
        //拉杆
        public static List<ScrewHole> SPScrewCList = new List<ScrewHole>();
        //EGP
        public static List<ScrewHole> EGPScrewCList = new List<ScrewHole>();
    }

    //ERP关注的零件和板的关联关系 导柱倒装 导柱过托
    public static class ShareItemBoardShipInfo
    {
        public static ExtraJudgeInfo extraShipInfo = new ExtraJudgeInfo();
    }

    //收集到的最终数据的零件 (识别出来的的)
    [Serializable]
    public static class ShareItemData
    {
        //识别出来的零件
        public static List<SingleItem> ItemList { get; set; } = new List<SingleItem>();
        //显示在界面上的零件(操作识别的零件)
        public static List<SingleItem> UIItemList { get; set; } = new List<SingleItem>();
        //和标准比对 缺识别的零件
        public static List<LabourSingleItem> SurplusItemList { get; set; } = new List<LabourSingleItem>();
        //显示在界面上的 缺识别和手动添加的零件
        public static List<LabourSingleItem> UISurplusItemList { get; set; } = new List<LabourSingleItem>();
        //手动界面 
        //零件数据
        public static List<ManualItem> MItemList { get; set; } = new List<ManualItem>();
    }

    //平面图共享数据
    public static class TopViewShareData
    {
        //非块的圆
        public static List<CAD_Circle> TopViewCircleList { get; set; } = new List<CAD_Circle>();
        //块圆
        public static List<MixedCAD_Circle> TopViewBlockCircleList { get; set; } = new List<MixedCAD_Circle>();
    }

    //用户操作模式
    public enum CustomOperPatternType
    {
        AUTO = 0,//自动识别模式
        MANUAL,//手动模式
        TEMP//中途记录
    }

    //组装图共享数据
    [Serializable]
    public static class AssemblyShareData
    {
        //操作模式
        public static CustomOperPatternType operType { get; set; } = CustomOperPatternType.AUTO;
        //KO孔加工项目
        public static KOHoleProcessInfo koHoleProcessinfo { get; set; } = new KOHoleProcessInfo();
        //弹簧孔加工项目
        public static SHoleProcessInfo sHoleProcessInfo { get; set; } = new SHoleProcessInfo();
        //中托司加工项目
        public static EGPProcessinfo egpProcessinfo { get; set; } = new EGPProcessinfo();

        //自动识别模式
        //客图组装图推算出来的第一块板的中点
        public static MixedCAD_Point AVCCenterInfo { get; set; } = new MixedCAD_Point();
        //平面图 组装图 客图绝对坐标 在允许范围内
        public static Boolean avtvAbsCCoorF { get; set; } = false;
        //屏幕数据
        public static List<BoardSectionItem> AUIBlueSectionList { get; set; } = new List<BoardSectionItem>();
        //板区间信息
        public static List<BoardSectionItem> ASectionList { get; set; } = new List<BoardSectionItem>();
        //操作客图文档
        public static string OperCustomerDocName = null;
        //手动模式
        //板数据
        public static List<ManualBoardItem> MSectionList { get; set; } = new List<ManualBoardItem>();

        //用于记录框选(打上标注的不再重复标注)
        public static Dictionary<string, List<LbaeldefiInfo>> OperLabelDic = new Dictionary<string, List<LbaeldefiInfo>>();
    }


    //方铁
    public static class FangtieShareData
    {
        public static FangtieType FType = FangtieType.None;
        //各个方铁的数据
        public static List<SingleFangtieItem> FangtieList = new List<SingleFangtieItem>();
        public static Boolean HasLRF = true;
        ////左右两条方铁分界线X信息
        //public static double? FLXInfo = null;
        //public static double? FRXInfo = null;
        public static FangtieXInfo FLXInfo = new FangtieXInfo();
        public static FangtieXInfo FRXInfo = new FangtieXInfo();
        //没有方铁情况下 模拟左右两条方铁 分界X信息
        //public static double? NOFLX = null;
        //public static double? NOFRX = null;

        public static FangtieXInfo NOFLXInfo = new FangtieXInfo();
        public static FangtieXInfo NOFRXInfo = new FangtieXInfo();

        //拉杆一侧界线 (导柱的另一侧)
        public static double? SPAnotherFX = null;
        public static ReckFangtieInfo reckLFInfo = new ReckFangtieInfo();
        public static ReckFangtieInfo reckRFInfo = new ReckFangtieInfo();
        public static ReckFangtieInfo reckCFInfo = new ReckFangtieInfo();
    }

    //方铁X信息
    public class FangtieXInfo
    {
        //客图X
        public double CustomerX { get; set; }
        //转换后X
        public double SplitX { get; set; }
        //赋值标识
        public Boolean F { get; set; } = false;

    }

    //窗体
    public static class CADCommonForm
    {
        public static Form activeForm = null;

        public static Form DataFrom = null;
        public static Form RecordFrom = null;
        // 窗体是否创建
        public static bool hasDataForm = false;
        public static bool hasRecordForm = false;

        //下拉框选择的系统
        public static string MoldTypeStr = null;
        //下拉框选择的花式
        public static string CategoryStr = null;
        //自动识别界面
        //被操作的板下标
        public static int autoOperBoardIndex = -1;
        //被操作的识别出来零件下标
        public static int autoOperItemIndex = -1;

        //手动界面
        //被操作的板下标
        public static int mOperBoardIndex = -1;

    }

    //筛选完后 标准范围内的零件 直径&拉令
    public static class StandardShareScopeItemParam {
        //小螺丝
        public static List<int> SmallSScrewDimList = new List<int>();
        //大螺丝
        public static List<int> BigSScrewDimList = new List<int>();
        //针板
        public static List<int> FallerSScrewDimList = new List<int>();
        //回针
        public static List<int> ReturnPinDimList = new List<int>();
        //导柱
        public static List<int> GPSScrewDimList = new List<int>();
        //拉杆
        public static List<int> SPScrewDimList = new List<int>();
        //拉令
        public static PullingDimItem PullingDimParam = new PullingDimItem();

        static public void ClearStandardScopeData()
        {
            SmallSScrewDimList = new List<int>();
            BigSScrewDimList = new List<int>();
            FallerSScrewDimList = new List<int>();
            ReturnPinDimList = new List<int>();
            GPSScrewDimList = new List<int>();
            SPScrewDimList = new List<int>();
            PullingDimParam = new PullingDimItem();
            //DataForm.AutoPageClearProcessData();
        }
    }

    //从数据库 获取 的 参数配置
    public static class ParamsConfigData {

        public static List<StandardMoldType> MoldTypeList = new List<StandardMoldType>();
        public static List<StandardSteel> StandardSteelList = new List<StandardSteel>();
        public static List<StandardEGP> StandardEGPList = new List<StandardEGP>();
        //导柱 
        public static List<StandardGPSP> StandardGPList = new List<StandardGPSP>();
        //拉杆
        public static List<StandardGPSP> StandardSPList = new List<StandardGPSP>();
        //回针
        public static List<StandardRP> StandardRPList = new List<StandardRP>();
        public static List<StandardScrew> StandardScrewList = new List<StandardScrew>();
        public static List<StandardCategoryBoard> FancyPlateList = new List<StandardCategoryBoard>();
        //标准孔
        public static List<StandardHoleData> MoldHoleList = new List<StandardHoleData>();
        //标准拉令
        public static List<StandardPulling> StandardPullingList = new List<StandardPulling>();
        //板和零件对应关系 用于识别比对
        public static List<StandardSeriesRelItem> StandardBoardRelItemList = new List<StandardSeriesRelItem>();
        //当前用户的已上传记录
        public static List<AMTypeUPloadRecordInfo> userAMUploadRIList = new List<AMTypeUPloadRecordInfo>();
        //当前用户 暂存的 中途记录
        public static List<AMTypeUPloadRecordInfo> userTempRecordList = new List<AMTypeUPloadRecordInfo>();
        //客户
        public static List<VCustomer> CustomerList = new List<VCustomer>();
        //接单信息
        public static List<QuoUser> QuoUserList = new List<QuoUser>();
        //推荐零件Dim字典
        public static Dictionary<string, int> RecommendDimDic = new Dictionary<string, int>();
        //按标准板厚(推荐)
        public static List<StandardBoardThick> StandardBoardThickList = new List<StandardBoardThick>();
        //按标准板宽(推荐)
        public static List<StandBoardWidth> StandardBoardWidthList = new List<StandBoardWidth>();
        //花式&零件装配关系
        public static List<StandardBoardItemNormSub> StandardBoardItemNormSubList = new List<StandardBoardItemNormSub>();
        public static List<StandardSPScrewMeson> StandardSPScrewMesonList = new List<StandardSPScrewMeson>();
    }

}
